import 'package:floor/floor.dart';

import 'message_db.dart';

@dao
abstract class MessageDao {
  @Query('SELECT * FROM Message')
  Future<List<MessageDb>> findAllMessages();

  @Query('SELECT * FROM Message WHERE msg_client_id = :userId')
  Future<List<MessageDb>> findMessagesByUserId(String userId);

  @insert
  Future<void> insertMessage(MessageDb message);

  @update
  Future<void> updateMessage(MessageDb message);

  @delete
  Future<void> deleteMessage(MessageDb message);

  @Query('DELETE FROM Message')
  Future<void> deleteAllMessages();
}
